using System.ServiceModel;
using System.ServiceModel.Description;
using Microsoft.Extensions.Configuration;

namespace HengTong.Kingdee.WSExportMaterialGroupFacadeSrvProxyService
{
    /// <summary>
    /// Partial class扩展，用于从配置文件读取服务地址
    /// 这个文件不会被自动生成工具覆盖
    /// </summary>
    public partial class WSExportMaterialGroupFacadeSrvProxyClient
    {
        // 服务路径常量
        private const string ServicePath = "/ormrpc/services/WSExportMaterialGroupFacade";

        /// <summary>
        /// 从配置文件创建客户端实例
        /// </summary>
        public static WSExportMaterialGroupFacadeSrvProxyClient CreateFromConfiguration(IConfiguration configuration = null)
        {
            var endpoint = KingdeeEASClientHelper.CreateEndpointAddress(ServicePath, configuration);
            var binding = KingdeeEASClientHelper.CreateStandardBinding();

            return new WSExportMaterialGroupFacadeSrvProxyClient(binding, endpoint);
        }

        /// <summary>
        /// ConfigureEndpoint partial method implementation
        /// 使用统一的配置方法
        /// </summary>
        static partial void ConfigureEndpoint(ServiceEndpoint serviceEndpoint, ClientCredentials clientCredentials)
        {
            KingdeeEASClientHelper.ConfigureEndpoint(serviceEndpoint, clientCredentials);
        }
    }
}
